<template>
  <div>
    <div class="pladtform-header">
      <h1>参与投标</h1>
    </div>
    <div class="platform-main">
      <el-table :data="tableData" style="width: 80%; margin-left: 100px">
        <el-table-column
          prop="date"
          label="序号"
          align="center"
          width="80"
          type="index"
        />
        <el-table-column prop="title" label="标的发布名称" width="300">
          <template slot-scope="scope">
            <span class="pointer" @click="getDetail(scope.row.announcementId)">
              {{ scope.row.title }}
            </span>
          </template>
        </el-table-column>
        <el-table-column prop="bidType" label="状态">
          <template slot-scope="scope">
            {{
              scope.row.bidType === 0
                ? "报名成功"
                : scope.row.bidType === 1
                ? "已过期"
                : scope.row.bidType === 2
                ? "资质审核"
                : scope.row.bidType === 3
                ? "待开标"
                : scope.row.bidType === 4
                ? "开标结果"
                : ""
            }}
          </template>
        </el-table-column>

        <el-table-column prop="endTime" label="标的结束时间" width="180">
          <template slot-scope="scope">
            <!-- 图标 -->
            <i class="el-icon-time" style="margin-right: 10px"></i>
            <!-- 时间 -->
            <span>{{ scope.row.endTime }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="bidType" label="操作" width="80">
          <template slot-scope="scope">
            <el-button type="text" :disabled="scope.row.bidType < 5">{{
              scope.row.bidType >= 5 ? "点击报名" : "报名"
            }}</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="platform-footer" style="margin-left: 75%">
      <el-pagination
        :current-page.sync="pageIndex"
        :page-size="pageSize"
        :disabled="disabled"
        background
        layout=" prev, pager, next"
        :total="total"
        @current-change="getMarkList"
      />
    </div>
  </div>
</template>


<script>
import { getMarkList, updMarkListById } from "@/api/user/bidlist";

export default {
  name: "bidlist",
  data() {
    return {
      disabled: false,
      tableData: [],
      pageIndex: 1,
      pageSize: 5,

      total: 0,
    };
  },
  methods: {
    async getMarkList() {
      const res = await getMarkList({
        pageIndex: this.pageIndex,
        pageSize: this.pageSize,
        userId: this.userId,
      });
      this.tableData = res.data;
      this.total = res.total;
      console.log(this.tableData);
    },
    getDetail(val) {
      // 跳转详情页
      this.$router.push({
        path: "/infnoticedetail",
        query: { listId: val },
      });
      // console.log(val);
      // console.log(val.listId);
    },
  },
  mounted() {
    this.getMarkList();
  },
};
</script>

<style  scoped>
h1 {
  text-align: center;
}
.pointer {
  cursor: pointer;
}
</style>
